/*
* Copyright (c) 2011
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
*
* Contributors:
*
* Description:
*
*/
#ifndef ROKUSEARCH_H
#define ROKUSEARCH_H

#include <QTcpSocket>
#include <QtGui/QDialog>
#include "WirelessRemote.h"
#include "ui_WirelessSearch.h"

QT_BEGIN_NAMESPACE
class QTcpSocket;
QT_END_NAMESPACE

struct Position {
    int row;
    int col;
};


class WirelessSearch : public QDialog
{
    Q_OBJECT

public:
    WirelessSearch(WirelessRemote *parent);
    ~WirelessSearch();

private:
    Ui::WirelessSearch ui;

    Position pos;

    void appendTextToSearch(QString string);
    void calculatePositionAndDoCommand(QString string);
    Position getLocationOfPressedLetter(QString letter);
    void setUpKeyboardMap();
    void handleSpecialKeyPress(QString letter);

    WirelessRemote *mainDlg;
    typedef QMap<QString, Position> PositionMap;
    PositionMap posMap;

    QString CLEAR_STR;
    QString DELETE_STR;
    QString SPACE_STR;

protected:
    void resizeEvent (QResizeEvent* event);

private slots:
    void on_zeroBut_clicked();
    void on_nineBut_clicked();
    void on_eightBut_clicked();
    void on_severBut_clicked();
    void on_sixBut_clicked();
    void on_fiveBut_clicked();
    void on_fourBut_clicked();
    void on_threeBut_clicked();
    void on_twoBut_clicked();
    void on_oneBut_clicked();
    void on_zBut_clicked();
    void on_yBut_clicked();
    void on_xBut_clicked();
    void on_wBut_clicked();
    void on_vBut_clicked();
    void on_uBut_clicked();
    void on_tBut_clicked();
    void on_sBut_clicked();
    void on_rBut_clicked();
    void on_qBut_clicked();
    void on_pBut_clicked();
    void on_oBut_clicked();
    void on_nBut_clicked();
    void on_mBut_clicked();
    void on_lBut_clicked();
    void on_kBut_clicked();
    void on_jBut_clicked();
    void on_iBut_clicked();
    void on_hBut_clicked();
    void on_gBut_clicked();
    void on_deleteButton_clicked();
    void on_spaceButton_clicked();
    void on_fBut_clicked();
    void on_eBut_clicked();
    void on_dBut_clicked();
    void on_cBut_clicked();
    void on_aBut_clicked();
    void on_bBut_clicked();
    void on_clearButton_clicked();
    void on_backButton_clicked();
};

#endif // ROKUSEARCH_H
